#!/bin/bash

function mail_notice()
{
    [ $# -lt 3 ] && return 1
    SUBJECT="$1"
    shift
    CONTENT="$1"
    shift
    TO_LIST=$*

    TO_WSC=`echo $TO_LIST | awk '{for (i=1;i<=NF;i++) { printf("%s", $i); if (i<NF) printf(";")} }'`

    echo -e "Subject: $SUBJECT\nTo: $TO_WSC\n\n$CONTENT" | sendmail -f dahai.zhao@hp.com -F "Lance" -t
}

function local_notice()
{
    [ $# -lt 1 ] && return 1
    CONTENT="$1"

    echo $CONTENT | wall    
}

[ "$SEA_DBG" != "" ] && mail_notice "$1" "$2" "$3"
#[ "$SEA_DBG" != "" ] && local_notice "$1"


